package com.wdd.libbase.util;


import androidx.lifecycle.LifecycleOwner;

import com.uber.autodispose.AutoDispose;
import com.uber.autodispose.AutoDisposeConverter;
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider;

/**
 * @ProjectName: Tools
 * @Package: com.wdd.tool.util
 * @ClassName: RxLifecycleUtils
 * @Description: java类作用描述
 * @Author: 王丹丹
 * @CreateDate: 2019/6/28 11:39
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/6/28 11:39
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class RxLifecycleUtils {
    private RxLifecycleUtils() {
        throw new IllegalStateException("Can't instance the RxLifecycleUtils");
    }

    public static <T> AutoDisposeConverter<T> bindLifecycle(LifecycleOwner lifecycleOwner) {
        return AutoDispose.autoDisposable(
                AndroidLifecycleScopeProvider.from(lifecycleOwner)
        );
    }
}
